package com.congwulin.wechat;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * 生成动态代理对象的工厂
 */
public class DynProxyFactory {
    public static Object getInstance(Object delegate){
        InvocationHandler handler = new SubjectInvocationHandler(delegate);
        Object proxy = null;
        proxy = Proxy.newProxyInstance(
                delegate.getClass().getClassLoader(),
                delegate.getClass().getInterfaces(),
                handler);
        return proxy;
    }
}
